package com.message.service;

import java.util.List;

import com.message.dao.BaseDao;
import com.message.entity.Message;

public class MessageServiceImpl implements MessageService {
	private BaseDao baseDao;

	public void setBaseDao(BaseDao baseDao) {
		this.baseDao = baseDao;
	}

	@SuppressWarnings("unchecked")
	public List<Message> getMessages(int pageNow, int pageSize) {
		return (List<Message>) baseDao.query("from Message order by id desc",
				0, pageNow, pageSize);
	}

	public int addMessage(Message message) {
		return baseDao.Update(message, 1);
	}
}
